<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>广告位管理</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__ADMIN__css/style.css"  media="all">
  <link rel="stylesheet" href="__ADMIN__layui/css/layui.css"  media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<div class="pad-20">
<fieldset class="layui-elem-field layui-field-title">
<legend>所属版位：{$category['title']}</legend>
</fieldset>
<eq name="category['is_lower']" value="1"><div class="news_search" style="margin-bottom:20px;">
  <div class="layui-inline">
    <a class="layui-btn newsAdd_btn" href="{:U('add',array('catid'=>$category['id']))}"><i class="layui-icon">&#xe61f;</i> 添加广告位</a>
  </div>
</div></eq>
<form name="myform" id="myform" action="" method="post">
<div class="layui-form">
  <table class="layui-table">
    <colgroup>
      <col width="80">
      <col width="200">
      <col width="100">
      <col width="100">
      <col >
      <col width="200">
    </colgroup>
    <thead>
      <tr>
        <th>排序</th>
        <th>广告标题</th>
        <th>状态</th>
        <th>图片</th>
        <th>描述</th>
        <th>管理操作</th>
      </tr>
    </thead>
    <tbody>
    <volist name="lists" id="val">
      <tr>
        <td>{$val['sort']}</td>
        <td>{$val['title']}</td>
        <td>{$val['status']}</td>
        <td><img src="{:thumb($val['image'])}" height="30"/></td>
        <td>{$val['description']}</td>
        <td>
            <a class="layui-btn layui-btn-warm layui-btn-mini" href="{:U('edit',array('catid'=>$val['catid'],'id'=>$val['id']))}"><i class="layui-icon">&#xe642;</i>编辑</a>
            <eq name="category['is_lower']" value="1">
            <a class="layui-btn layui-btn-danger layui-btn-mini action_del" data-id={$val['id']}><i class="layui-icon">&#xe640;</i>删除</a>
            </eq>
        </td>
      </tr>
    </volist>
    </tbody>
  </table>
</div>
</form>
</div>
<div class="yzui-filler"></div>
<script src="__ADMIN__js/jquery-1.9.1.min.js" charset="utf-8"></script>
<script src="__ADMIN__layui/layui.js" charset="utf-8"></script>
<script>
  layui.use('form', function(){
    var $ = layui.jquery, form = layui.form();
  });
  $(".action_del").click(function(){
    var _this = $(this);
    layer.confirm('确定删除此信息？',{icon:3, title:'提示信息'},function(index){
      var dataid = _this.attr("data-id");
      var catid = {$category['id']};
      $.post("{:U('del')}",{id:dataid,catid:catid},function(result){
        if(result == 1){
          _this.parents("tr").remove();
          layer.close(index);
        }else if(result == 0){
          layer.alert('服务器正忙，请稍后再试');
        }else{
          layer.alert('您没有权限访问');
        }
      });
    });
  });
</script>
</body>
</html>
